<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
</head>
<body>
<div id="app24">
    <label>Add a todo</label>
    <input v-model="temText"/><button v-on:click="addNewTodo">Add</button>
    <li v-for="(todo,index) in todos">{{ todo.text }}<button v-on:remove="todos.splice(index, 1)">Remove</button></li>

</div>

<script type="text/javascript">
    var vm = new Vue({
        el: '#app24',
        data: {
            todos: [],
            temId: 0,
            temText: '',
        },
        methods: {
            addNewTodo: function () {
                this.todos.push({
                    id: this.temId++,
                    text: this.temText
                })
            }
        }
    })
</script>
</body>
</html>